#ifndef COMPOSITORFLOW_H__
#define COMPOSITORFLOW_H__

#include "CompositorInclude.h"

template <class PEA>
class CompositorFlow
{
public:
	virtual void operator()(BaseCompositor<PEA>*	compositor) = 0;
};

template <class PEA,void (PEA::*funcPtr)()>
class CFlowForward : public CompositorFlow<PEA>
{
public:
	
	void operator()(BaseCompositor<PEA>*	compositor)
	{
		for (BaseCompositor<PEA>::compositorIterator iDx = compositor->m_ItemCol.begin(); iDx < compositor->end(); iDx++)
		CALL_MEMBER_FN(*(*iDx),funcPtr)();
	}
};

//template <class COMP>
//void FlowForward(COMP*	compositor)
//{
//	for (BaseCompositor<typename COMP::_PEA>::compositorIterator iDx = compositor->begin(); iDx < compositor->end(); iDx++)
//		CALL_MEMBER_FN(*(*iDx),funcPtr)();
//
//		
//}

template <class PEA,void (PEA::*functor)()>
void FlowForward(BaseCompositor<PEA>*	compositor)
{
	for (BaseCompositor<PEA>::compositorIterator iDx = compositor->begin(); iDx < compositor->end(); iDx++)
		CALL_MEMBER_FN(*(*iDx),functor)();
}

template <class COMP>
typename COMP::_RET FlowForward2(COMP*	compositor)
{
	typename COMP::_RET retVal;
	for (COMP::compositorIterator iDx = compositor->begin(); iDx < compositor->end(); iDx++)
		COMP::_TRAITS::returnModifier(retVal,CALL_MEMBER_FN(*(*iDx),functor)());

	return retVal;
}


template <class PEA,void (PEA::*functor)()>
void FlowBackward(BaseCompositor<PEA>*	compositor)
{
	for (BaseCompositor<PEA>::compositoreIteratorReverse iDx = compositor->rbegin(); iDx < compositor->rend(); iDx++)
		CALL_MEMBER_FN(*(*iDx),functor)();
}

#endif